package com.dgut.lotterySystem.common.pojo.exception;

import com.dgut.lotterySystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;

//@Data 生成自己的equals和hashcode
//@EqualsAndHashCode(callSuper = true) 用来生成RuntimeException的equals和hashcode
@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException{
    private Integer code;
    private String message;


    public ControllerException(){}

    public ControllerException(Integer code,String message){
        this.code=code;
        this.message=message;
    }

    public ControllerException(ErrorCode errorCode){
        this.code=errorCode.getCode();
        this.message=errorCode.getMsg();
    }
}
